package com.ztesoft.sca.service.user;

import com.ztesoft.sca.dao.user.ImRoleDao;
import com.ztesoft.sca.dao.user.ImRoleDaoImpl;
import com.ztesoft.sca.model.user.ImPrivilegePo;
import com.ztesoft.sca.model.user.ImRolePo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author liang.aozhao
 * @created 2018/5/17 12:03
 */
@Service
public class ImRoleServiceImpl implements ImRoleService {

    @Autowired
    ImRoleDao imRoleDao;

    @Override
    public long addImRole(ImRolePo imRolePo) throws Exception {
        return imRoleDao.addImRole(imRolePo);
    }

    @Override
    public void deleteImRole(ImRolePo imRolePo) throws Exception {
        imRoleDao.deleteImRole(imRolePo);
    }

    @Override
    public void updateImRole(ImRolePo imRolePo) throws Exception {
        imRoleDao.updateImRole(imRolePo);
    }

    @Override
    public ImRolePo getImRole(ImRolePo imRolePo) throws Exception {
        return imRoleDao.getImRole(imRolePo);
    }

    @Override
    public List<ImRolePo> listAllImRoles() throws Exception {
        return imRoleDao.listAllImRoles();
    }

    @Override
    public List<ImRolePo> listImRoleByUserId(Long userId) throws Exception {
        return imRoleDao.listImRoleByUserId(userId);
    }

    @Override
    public List<ImRolePo> listImRoleByOrgId(Long orgId) throws Exception {
        return imRoleDao.listImRoleByOrgId(orgId);
    }

    @Override
    public void addImRoleOrg(Long roleId, Long orgId) throws Exception {
        imRoleDao.addImRoleOrg(roleId, orgId);
    }

    @Override
    public void deleteImRoleOrg(Long roleId, Long orgId) throws Exception {
        imRoleDao.deleteImRoleOrg(roleId, orgId);
    }

    @Override
    public List<ImPrivilegePo> listImPrivilegeByRoleId(Long roleId) throws Exception {
        return imRoleDao.listImPrivilegeByRoleId(roleId);
    }
}
